﻿<cfsilent>
	<cfscript>

		event.setArg("pageTitle", "学籍档案");
		
		currentTab = event.getArg("TabID", "labWelcome");

		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		propAdvice = getProperty("serviceFactory").getBean("studentPropertyAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		stringAdvice = getProperty("serviceFactory").getBean("stringAdvice");

		chineseAdvice = getProperty("serviceFactory").getBean("chineseFactory");

		/* 学籍相关信息 */
		studentId = sessionAdvice.getAutherUserID();
	

		/* 学校信息 */
		sql = "SELECT sch_name FROM t_school ";
		
		queryObj = new Query( datasource=application.dnsSlave );

		rs_school = queryObj.execute( sql=sql ).getResult();
		
		
		/* 账户信息 */
		sql = "SELECT user_email FROM t_user WHERE user_id = :userId ";
		
		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="userId", value=studentId, cfsqltype="cf_sql_varchar" );

		rs_user = queryObj.execute( sql=sql ).getResult();
		
	
		/* 学生信息 */
		sql = "SELECT 
					t.cls_id, t.stu_id,
					t.stu_name, t.stu_name_english, 
					t.stu_sex, t.stu_birthday,
					CASE WHEN t.continent IS NULL THEN '-' ELSE t.continent END continent, 
					T.NATIONALITY, 
					t_idcard_type.idtype_name, t.stu_idcard,
					t_nation.nation_name, t.stu_name_used,
					t.sbj_direction, 
					(SELECT grade FROM (SELECT b.grade FROM i_Stu_Class_Info a 
						INNER JOIN t_class b ON b.cls_id = a.cls_id
						INNER JOIN t_student c ON c.stu_id = a.stu_id 
						WHERE c.stu_id = :studentId ORDER BY b.grade) WHERE ROWNUM = 1) grade_enter 
			   FROM 
					t_student t 
					INNER JOIN t_idcard_type ON t_idcard_type.idtype = t.idtype 
					INNER JOIN t_nation ON t_nation.nation_code = t.nation_code 
			   WHERE 
					t.stu_id = :studentId ";
				
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		
		rs_studentEntity = queryObj.execute( sql=sql ).getResult();

		
		/* 学生学籍信息 */
		sql = "SELECT  
					t_student_status.student_prop, t_student_status.candidatesno,
					CASE WHEN t_student_status.st_id IS NULL THEN '无' ELSE to_char(i_code_Info.name) END st_name,
					t_student_status.date_join, t_student_status.status_code, 
					t_student_status.homeaddr, t_student_status.zipcode, 
					t_student_status.is_married, 
					t_student_status.stu_tel, 
					t_student_status.stu_email, 
					t_student_status.ch_addr, 
					t_student_status.hsk_score,
					t_student_status.pt_date, 
					b.name f_name, 
					t_student_status.is_bachelor 
				FROM 
					t_student_status 
					INNER JOIN i_code_Info ON i_code_Info.code_id = t_student_status.st_id 
					INNER JOIN i_code_Info b ON b.code_Id = t_student_status.f_id 
				WHERE 
					t_student_status.stu_id = :studentId ";
				
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		
		rs_profileEntity = queryObj.execute( sql=sql ).getResult();
		

		/* 学生当前所在行政班 */
		sql = "SELECT grade, cls_found, cls_name FROM t_class WHERE cls_id = :classId ";
				
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="classId", value=rs_studentEntity.cls_id, cfsqltype="cf_sql_char" );
		
		rs_classEntity = queryObj.execute( sql=sql ).getResult();
		
		
		/*学生所有行政班*/
		sql = "SELECT b.cls_name, b.grade FROM i_stu_class_info a INNER JOIN t_class b on b.cls_id = a.cls_id WHERE a.stu_id = :studentId ORDER BY b.grade";
				
		queryObj = new Query( datasource=application.dnsSlave ) ;
		
   		queryObj.addParam( name="studentId", value=studentId, cfsqltype="cf_sql_varchar" );
		
		classArray = queryObj.execute( sql=sql ).getResult();
		
		
		/* 班级归属专业 */
		sql = "SELECT 
					t_subject.sbj_id, t_institute.institute_name,
					t_subject.sbj_name, t_subject.level_code,
					t_subject.schooling_length 
				FROM 
					t_class 
					INNER JOIN t_subject ON t_subject.sbj_id = t_class.sbj_id 
					INNER JOIN t_institute ON t_institute.institute_id = t_subject.institute_id 
				WHERE
					t_class.cls_id = :classId  ";
					
		queryObj = new Query( datasource=application.dnsSlave ) ;
   		queryObj.addParam( name="classId", value=rs_studentEntity.cls_id, cfsqltype="cf_sql_char" );
		
		rs_subjectEntity = queryObj.execute( sql=sql ).getResult();
	

		propAdvice.parseProperty( rs_profileEntity.student_prop );

		

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>学籍注册信息
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="welcome">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labWelcome">class="active"</cfif> id="labWelcome" tabTarget="Welcome">注册信息</span>
						<span <cfif currentTab eq "labModify">class="active"</cfif> id="labModify" tabTarget="Modify">修改个人信息</span>
                              <span <cfif currentTab eq "labPicture">class="active"</cfif> id="labPicture" tabTarget="Picture">照片</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					
					// -->
					//]]>
				</script>

				<div id="Welcome" class="tabContent">
				
					<div class="noticeBlock">
						<h3>教育部学籍管理注册信息数据</h3>
						<hr/>
					</div>
                          <cfset targetImg = getProperty("cdnAssetsPath") & "/student/profile/" & left(rs_studentEntity.stu_id,4) & "/" & rs_studentEntity.stu_id & ".jpg" />
                         <cfset target = getContextRoot() & "/acadmicRes/assets/profile/default.jpg" />
                         
                         <cfif fileExists(targetImg) >
                         	<cfset target = getContextRoot() & "/acadmicRes/assets/student/profile/" & left(rs_studentEntity.stu_id,4) & "/" & rs_studentEntity.stu_id & ".jpg" />
                         </cfif>
					<table class="UItable withBorder">
						<tr>
							<td>学号</td>
							<td colspan="2"><span class="number"><cfoutput>#rs_studentEntity.stu_id#</cfoutput></span></td>
                                   <td>护照号码</td>
							<td colspan="2"><span class="number"><cfoutput>#rs_studentEntity.stu_idcard#</cfoutput></span></td>
							<td style="padding:0;" width="135" height="180" valign="middle" align="center" rowspan="6"><img width="135" height="180" align="middle" src="<cfoutput>#target#</cfoutput>" /></td>
						</tr>
						<tr>
							<td>中文用名</td>
							<td colspan="2"><cfoutput>#rs_studentEntity.stu_name#</cfoutput></td>
                                   <td>护照用名</td>
							<td colspan="2"><cfoutput>#rs_studentEntity.stu_name_english#</cfoutput></td>
						</tr>
                              <tr>
						
							<td>性别</td>
							<td colspan="2"><cfif rs_studentEntity.stu_sex eq "1">男<cfelse>女</cfif></td>
                                   <td>有效期限</td>
							<td colspan="2"><span class="number"><cfoutput>#rs_profileEntity.pt_date#</cfoutput></span></td>
							
						</tr>
						<tr>
							<td colspan="1">出生日期</td>
							<td colspan="2"><span class="number"><cfoutput>#rs_studentEntity.stu_birthday#</cfoutput></span></td>
							<td>洲别</td>
							<td colspan="2"><cfoutput>#rs_studentEntity.continent#</cfoutput></td>
						</tr>
						<tr>
							<td>婚姻状况</td>
							<td colspan="2"><cfif rs_profileEntity.is_married eq '1'>
												<cfoutput>已婚</cfoutput>
                                                      	<cfelse>
                                                       	<cfoutput>未婚</cfoutput>
                                                   </cfif></td>
                                   <td>国籍</td>
							<td colspan="2"><cfoutput>#rs_studentEntity.nationality#</cfoutput></td>
						</tr>
                              	<tr>
							<td>职业</td>
							<td colspan="2"><cfoutput>##</cfoutput></td>
                                   <td>经费来源</td>
							<td colspan="2"><cfoutput>#rs_profileEntity.f_name#</cfoutput></td>
						</tr>
                              </tr>
                              	<tr>
							<td>来校前学历</td>
							<td colspan="2"><cfoutput>##</cfoutput></td>
                                   <td>是否本科</td>
							<td colspan="5"><cfif rs_profileEntity.is_bachelor EQ '1' >
												<cfoutput>是</cfoutput>
                                                       <cfelse>
                                                       	<cfoutput>否</cfoutput>
                                                   </cfif></td>
						</tr>
                                </tr>
                              	<tr>
							<td>HSK成绩</td>
							<td colspan="2">
								<cfswitch expression="#rs_profileEntity.hsk_score#">
									<cfcase value=""><cfoutput>无</cfoutput></cfcase></td>
                                             <cfcase value="0"><cfoutput>未通过</cfoutput></cfcase></td>
                                             <cfcase value="1"><cfoutput>HSK基础C级（分数等级:1级）</cfoutput></cfcase></td>
                                             <cfcase value="2"><cfoutput>HSK基础B级（分数等级:2级）</cfoutput></cfcase></td>
                                             <cfcase value="3"><cfoutput>HSK基础A级（分数等级:3级）</cfoutput></cfcase></td>
                                             <!---<cfcase value="3"><cfoutput>HSK初等C级（分数等级:3级）</cfoutput></cfcase></td>--->
                                             <cfcase value="4"><cfoutput>HSK初等B级（分数等级:4级）</cfoutput></cfcase></td>
                                             <cfcase value="5"><cfoutput>HSK初等A级（分数等级:5级）</cfoutput></cfcase></td>
                                             <cfcase value="6"><cfoutput>HSK中等C级（分数等级:6级）</cfoutput></cfcase></td>
                                             <cfcase value="7"><cfoutput>HSK中等B级（分数等级:7级）</cfoutput></cfcase></td>
                                             <cfcase value="8"><cfoutput>HSK中等A级（分数等级:8级）</cfoutput></cfcase></td>
                                             <cfcase value="9"><cfoutput>HSK初等C级（分数等级:9级）</cfoutput></cfcase></td>
                                             <cfcase value="10"><cfoutput>HSK初等B级（分数等级:10级）</cfoutput></cfcase></td>
                                             <cfcase value="11"><cfoutput>HSK初等A级（分数等级:11级）</cfoutput></cfcase></td>
                                        </cfswitch>
                                   <td>学生类型</td>
							<td colspan="5"><cfoutput>#rs_profileEntity.st_name#</cfoutput></td>
						</tr>
					
						<!---<tr>
							<td>专业名称</td>
							<td colspan="2"><cfoutput>#rs_subjectEntity.sbj_name#</cfoutput></td>
                                   <td>层次</td>
							<td colspan="3"><cfoutput>#dictAdvice.getStudentLevel(rs_subjectEntity.level_code)#</cfoutput></td>
						</tr>--->
					
						<tr>
							<td>入学日期</td>
							<td colspan="2"><span class="number"><cfif rs_profileEntity.date_join eq ""><cfoutput>#datetimeAdvice.formatDateString(rs_classEntity.cls_found & "01")#</cfoutput><cfelse><cfoutput>#rs_profileEntity.date_join#</cfoutput></cfif></span></td>
							<td>学籍状态</td>
							<td colspan="3"><cfoutput>#dictAdvice.getStudentCurrentStatus(rs_profileEntity.status_code)#</cfoutput></td>
						</tr>
                              	<tr>
							<td>个人爱好</td>
							<td colspan="6"><cfoutput>##</cfoutput></td>
						</tr>
					</table>
					<div class="noticeBlock">
						
						<h3>校内学籍信息数据</h3>
						<hr/>
					</div>
					<table class="UItable withBorder">
						<tr>
							<td>学号</td>
							<td><span class="number"><cfoutput>#rs_studentEntity.stu_id#</cfoutput></span></td>
							<td>姓名</td>
							<td><cfoutput>#rs_studentEntity.stu_name#</cfoutput></td>
							<td>曾用名</td>
							<td><cfif rs_studentEntity.stu_name_used neq "">
									<cfoutput>#rs_studentEntity.stu_name_used#</cfoutput>
									<cfelse>
									-
								</cfif></td>
						</tr>
						<tr>
							<td>行政班</td>
                                   <cfset num_t = 0 />
							<td><cfloop query="classArray">
                                  			<cfset num_t++ />
                                   		<cfif right(classArray.grade, 1) EQ 1 >
                                             		<cfoutput>#left(classArray.grade,4)-1#--#left(classArray.grade,4)#第2学期</cfoutput>-<cfoutput>#classArray.cls_name#</cfoutput>
                                             	<cfelse>
                                                  	<cfoutput>#left(classArray.grade,4)#--#left(classArray.grade,4)+1#第1学期</cfoutput>-<cfoutput>#classArray.cls_name#</cfoutput>
                                             </cfif><br />
                                        </cfloop></td>
							<td>年级</td>
							<td><span class="number"><cfoutput>#rs_classEntity.grade#</cfoutput></span></td>
							<td>预期毕业年份</td>
                                   <cfif rs_studentEntity.grade_enter neq "" >
								<td><span class="number"><cfoutput>#int((left(rs_studentEntity.grade_enter,4) + rs_subjectEntity.schooling_length)) & right(rs_studentEntity.grade_enter, 1)#</cfoutput></span></td>
                                    <cfelse>
                                    	<td><span class="number">没有班级数据</span></td>
                                    </cfif>
						</tr>
						<tr>
							<td>是否在校</td>
							<td><cfif propAdvice.getInSchool()>是<cfelse><span class="alert">否</span></cfif></td>
							<td>专业</td>
							<td><cfoutput>#rs_subjectEntity.sbj_name#</cfoutput></td>
							<td>专业方向</td>
							<td><cfif rs_studentEntity.sbj_direction eq "0">
									无
									<cfelse>
                                    <cfset sql = "SELECT sbj_name FROM t_subject WHERE sbj_id = :dirId "/>
                                    
                                    <cfset queryObj = new Query( datasource=application.dnsSlave )/>
                                    <cfset queryObj.addParam( name="dirId", value=rs_subjectEntity.sbj_id &rs_studentEntity.sbj_direction, cfsqltype="cf_sql_varchar" )/>
                                    
                                    <cfset rs_direction= queryObj.execute( sql=sql ).getResult()/>
                                    
									<cfif rs_direction.recordCount>
										<cfoutput>#rs_direction.sbj_name#</cfoutput>
									</cfif>
								</cfif></td>
						</tr>
					</table>
                         
                         <div class="noticeBlock">
						<h3>联系方式</h3>
						<hr/>
					</div>
					<table class="UItable withBorder">
						<tr>
							<td colspan="1">电子邮件</td>
							<td><cfoutput>#rs_profileEntity.stu_email#</cfoutput></span></td>
							<td colspan="1">电话号码</td>
							<td><cfoutput>#rs_profileEntity.stu_tel#</cfoutput></td>
						</tr>
                              <tr>
							<td colspan="1">固定住址</td>
							<td colspan="7"><cfoutput>#stringAdvice.HTMLEncode( rs_profileEntity.homeaddr )#</cfoutput></td>
						</tr>
							
						<tr>
							<td colspan="1">在华住址</td>
							<td colspan="7"><cfoutput>#stringAdvice.HTMLEncode( rs_profileEntity.ch_addr )#</cfoutput></td>
						</tr>
					</table>
				</div>
				
				<div id="Modify" class="tabContent">
					
					<div class="noticeBlock">
						<h3>修改您的联系方式</h3>
						<hr/>
					</div>
					
					<form id="formBasic" onSubmit="javascript:return processVerfiyForm('formBasic');" class="formWrapper" method="post" action="<cfoutput>#buildURL('profileUpdateDo')#</cfoutput>">
					
                         	<input name="StudentID" id="StudentID" type="hidden" class="typeText inlinePart" maxlength="100" value="<cfoutput>#studentId#</cfoutput>" />
						
                              <div class="label">
							<b>性别</b>
							<input name="Sex" type="radio" class="typeRadio" value="1" <cfif event.getArg('studentSex', rs_studentEntity.stu_sex) eq "1">checked="checked"</cfif> />男
							<input name="Sex" type="radio" class="typeRadio" value="2" <cfif event.getArg('studentSex', rs_studentEntity.stu_sex) eq "2" >checked="checked"</cfif> />女
                               </div>
						
						
						<hr/>
						
						<div class="label">
							<b>家庭通讯地址</b>
							<input name="homeAddr" id="homeAddr" type="text" class="typeText inlinePart" maxlength="100" value="<cfoutput>#stringAdvice.HTMLFormEncode( event.getArg( 'HomeAddress', rs_profileEntity.homeaddr ) )#</cfoutput>" />
						</div>
                              <div class="label">
							<b>在华住址</b>
							<input name="chAddr" id="chAddr" type="text" class="typeText inlinePart" maxlength="100" value="<cfoutput>#stringAdvice.HTMLFormEncode( event.getArg( 'HomeAddress', rs_profileEntity.ch_addr ) )#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>电子邮件</b>
							<input name="EmailAddress" id="EmailAddress" type="text" class="typeEnglish" maxlength="120" value="<cfoutput>#stringAdvice.HTMLFormEncode( event.getArg( 'EmailAddress', rs_user.user_email ) )#</cfoutput>" />
						</div>
						
						<div class="label">
							<b>联系电话</b>
							<input name="telephone" id="telephone" type="text" class="typeEnglish" maxlength="16" value="<cfoutput>#stringAdvice.HTMLFormEncode( event.getArg( 'StudentTelephone', rs_profileEntity.stu_tel ) )#</cfoutput>" />
						</div>
                              
                               <hr/>
						<div class="label">
                              <p class="notice">如果不修改密码，请留空</p>
							<b>用户密码</b>
							<input name="password" id="password" type="password"  verification="password" class="typeEnglish" maxlength="16" value="" />
						</div>
                              <div class="label">
							<b>密码确认</b>
							<input name="password2" id="password2" type="password"  verification="password" class="typeEnglish" maxlength="16" value="" />
						</div>
						
						<hr/>

						<div class="lable">
							<input class="button" type="submit" value="更新" />
						</div>
						
					</form>
					
				</div>
                    
                    <div id="Picture" class="tabContent">
					<div class="noticeBlock">
						<h3>电子照片</h3>
						<hr/>
					</div>
                         
                           <cfset targetImg = getProperty("cdnAssetsPath") & "/student/print/" & left(rs_studentEntity.stu_id,4) & "/" & rs_studentEntity.stu_id & ".jpg" />
                         <cfset target = getContextRoot() & "/acadmicRes/assets/profile/default_p.jpg" />
                         
                         <cfif fileExists(targetImg) >
                         	<cfset target = getContextRoot() & "/acadmicRes/assets/student/print/" & left(rs_studentEntity.stu_id,4) & "/" & rs_studentEntity.stu_id & ".jpg" />
                         </cfif>
					
					<div class="mbl">
						<img class="img_border" width="240" height="320" src="<cfoutput>#target#</cfoutput>" />
					</div>

					<form target="output" id="formPic" onSubmit="javascript:return processVerfiyForm('formPic');" class="formWrapper" method="post" enctype="multipart/form-data" action="<cfoutput>#buildURL('uploadStudentPicDo')#</cfoutput>">
						<input type="hidden" name="StudentID" value="<cfoutput>#rs_studentEntity.stu_id#</cfoutput>" />
						
						<div class="label">
							<span class="req">*</span><b>更新照片</b>
							<input name="upload" id="upload" type="file" verification="required" />
							<p class="notice">请使用至少 360x480 尺寸（比例4:3）的 jpg 图片作为上传文件</p>
						</div>
						
						<div class="lable"><input id="importTrigger" class="button" type="submit" value="更新照片" /></div>
						
					</form>
					
					<script language="javascript" type="text/javascript">
						//<![CDATA[
						<!--
						$(document).ready(function() {
							$("#importTrigger").click(function(){
								
								if ( processVerfiyForm('formPic') ) {
									$("#output").attr("src","about:blank").removeClass("hidden_elem");
								}
								
							});
						});
						// -->
						//]]>
					</script>
					
					
					<iframe name="output" id="output" class="UIframeBox hidden_elem" src="about:blank" frameborder="0"></iframe>

				</div>
                    

			</div>
		</li>
	</ul>
</div>
